//package com.xiaoKe.zhonghzu.ui.data;
//
//import android.os.Bundle;
//import android.text.TextUtils;
//import android.view.MotionEvent;
//import android.view.View;
//import android.widget.AdapterView;
//import android.widget.ArrayAdapter;
//
//import androidx.recyclerview.widget.GridLayoutManager;
//import androidx.recyclerview.widget.LinearLayoutManager;
//import androidx.recyclerview.widget.RecyclerView;
//
//import com.xiaoKe.zhonghzu.R;
//import com.xiaoKe.zhonghzu.databinding.FragmentDataBinding;
//import com.xiaoKe.zhonghzu.global.base.BaseFragment;
//import com.xiaoKe.zhonghzu.global.base.VeinRouter;
//import com.xiaoKe.zhonghzu.global.bean.GeneralData;
//import com.xiaoKe.zhonghzu.ui.onClick.OnClickListenerPositionInt;
//import com.xiaoKe.zhonghzu.ui.onClick.OnClickListenerPositionObject;
//
//
//import java.time.LocalDate;
//import java.util.ArrayList;
//import java.util.List;
//import java.util.stream.Collectors;
//
///**
// * @ProjectName : xiaoke-pad-zhongzhu
// * @Author : Shijingna
// * @Time : 2024/11/27 08:39
// * @Description : 数据
// */
//public class DataFragment extends BaseFragment<FragmentDataBinding> {
//    EnvListAdapter envListAdapter;
//    List<GeneralData> listDay = new ArrayList<>();
//    List<GeneralData> listHead = new ArrayList<>();
//    List<GeneralData> listTest = new ArrayList<>();
//    DataListAdapter dataListAdapter;
//    private int index;
//
//    @Override
//    protected void initView() {
//        listTest.add(new GeneralData("ZZWT4-2024", "提交时间：2024-11-27 11:20", "1"));
//        listTest.add(new GeneralData("ZZWT4-2024", "提交时间：2024-11-27 11:20", "1"));
//        listTest.add(new GeneralData("ZZWT4-2024", "提交时间：2024-11-27 11:20", "1"));
//        listTest.add(new GeneralData("ZZWT4-2024", "提交时间：2024-11-27 11:20", "1"));
//
//        listTest.add(new GeneralData("ZZWT4-2024", "提交时间：2024-11-27 11:20", "2"));
//        listTest.add(new GeneralData("ZZWT4-2024", "提交时间：2024-11-27 11:20", "2"));
//        listTest.add(new GeneralData("ZZWT4-2024", "提交时间：2024-11-27 11:20", "2"));
//
//        listTest.add(new GeneralData("ZZWT4-2024", "提交时间：2024-11-27 11:20", "3"));
//
//        listTest.add(new GeneralData("SPBD8-2024", "提交时间：2024-11-12 12:20", "4"));
//        listTest.add(new GeneralData("SPBD7-2024", "提交时间：2024-11-11 11:20", "4"));
//        listTest.add(new GeneralData("SPBD5-2024", "提交时间：2024-11-08 10:20", "4"));
//        listTest.add(new GeneralData("SPBD4-2024", "提交时间：2024-11-07 11:20", "4"));
//
//
//        listTest.add(new GeneralData("JYLB3-2024", "提交时间：2024-11-13 09:20", "5"));
//        listTest.add(new GeneralData("JYLB4-2024", "提交时间：2024-11-12 18:20", "5"));
//        listTest.add(new GeneralData("JYLB3-2024", "提交时间：2024-11-12 12:20", "5"));
//
//        listDay.add(new GeneralData("近3天", LocalDate.now().minusDays(3)));
//        listDay.add(new GeneralData("近7天", LocalDate.now().minusDays(7)));
//        listDay.add(new GeneralData("近15天", LocalDate.now().minusDays(15)));
//        listDay.add(new GeneralData("近30天", LocalDate.now().minusDays(30)));
//
//        listHead.add(new GeneralData("生长性状", "1"));
//        listHead.add(new GeneralData("繁殖性状", "2"));
//        listHead.add(new GeneralData("胴体性状", "3"));
//        listHead.add(new GeneralData("肌肉品质", "4"));
//        listHead.add(new GeneralData("精液品质", "5"));
//
//        binding.swipeRecyclerView.setLayoutManager(new GridLayoutManager(getContext(), listHead.size()));
//        envListAdapter = new EnvListAdapter(listHead);
//        envListAdapter.setOnClickListenerPositionInt(new OnClickListenerPositionInt() {
//            @Override
//            public void onItemClick(int item) {
//                index = item;
//                dataListAdapter.setData(listTest.stream().filter(t -> t.getName().equals(listHead.get(item).getV().toString())).collect(Collectors.toList()));
//            }
//        });
//        binding.swipeRecyclerView.setAdapter(envListAdapter);
//        //列表
//        binding.swipeRecyclerViewList.setLayoutManager(new LinearLayoutManager(getContext()));
//        dataListAdapter = new DataListAdapter();
//        dataListAdapter.setData(listTest.stream().filter(t -> t.getName().toString().equals("1")).collect(Collectors.toList()));
//        dataListAdapter.setOnClickListenerPositionInt(new OnClickListenerPositionObject() {
//            @Override
//            public void onItemClick(Object ob) {
//                Bundle bundle = new Bundle();
//                switch (ob.toString()) {
//                    case "1":
//                        bundle.putString("titleName", VeinRouter.GROWTHDETAILS.getTitle());
//                        toFragmentPage(VeinRouter.GROWTHDETAILS.setBundle(bundle));
//                        break;
//                    case "2":
//                        bundle.putString("titleName", VeinRouter.REPRODUCTIVEDETAILS.getTitle());
//                        toFragmentPage(VeinRouter.REPRODUCTIVEDETAILS.setBundle(bundle));
//                        break;
//                    case "3":
//                        bundle.putString("titleName", VeinRouter.CARCASSDETAILS.getTitle());
//                        toFragmentPage(VeinRouter.CARCASSDETAILS.setBundle(bundle));
//                        break;
//                    case "4":
//                        bundle.putString("titleName", VeinRouter.MUSCLEDETAILS.getTitle());
//                        toFragmentPage(VeinRouter.MUSCLEDETAILS.setBundle(bundle));
//                        break;
//                    case "5":
//                        bundle.putString("titleName", VeinRouter.SEMENDETAILS.getTitle());
//                        toFragmentPage(VeinRouter.SEMENDETAILS.setBundle(bundle));
//                        break;
//                }
//            }
//        });
//        binding.swipeRecyclerViewList.setAdapter(dataListAdapter);
//    }
//
//    @Override
//    protected void initData() {
//        //搜搜内容
//        binding.sousuo.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View view) {
//                if (TextUtils.isEmpty(binding.content.getText().toString())) {
//                    dataListAdapter.setData(listTest.stream().filter(t -> t.getName()
//                            .equals(listHead.get(index).getV().toString()))
//                            .collect(Collectors.toList()));
//                } else {
//                    dataListAdapter.setData(listTest.stream().filter(t -> t.getName()
//                            .equals(listHead.get(index).getV().toString()) && t.getK().toString().contains(binding.content.getText().toString()))
//                            .collect(Collectors.toList()));
//                }
//
//
//            }
//        });
//        binding.timerMode.setOnTouchListener(new View.OnTouchListener() {
//            @Override
//            public boolean onTouch(View v, MotionEvent event) {
//                if (event.getAction() == MotionEvent.ACTION_DOWN) {
//                    list();
//                    return true; // 返回 true 表示事件已被处理
//                }
//                return false;
//            }
//        });
//        binding.dayRelativeLayout.setOnTouchListener(new View.OnTouchListener() {
//            @Override
//            public boolean onTouch(View v, MotionEvent event) {
//                if (event.getAction() == MotionEvent.ACTION_DOWN) {
//                    list();
//                    return true; // 返回 true 表示事件已被处理
//                }
//                return false;
//            }
//        });
//
//
//    }
//
//    public void list() {
//        ArrayAdapter<String> adapterMode = new ArrayAdapter<String>(getContext(),
//                R.layout.simple_dropdown_item, listDay.stream().map(t -> t.getK().toString()).collect(Collectors.toList()));
//        binding.timerMode.setAdapter(adapterMode);
//        binding.timerMode.showDropDown();
//        binding.timerMode.setOnItemClickListener(new AdapterView.OnItemClickListener() {
//            @Override
//            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//                binding.timerMode.setText(listDay.get(position).getK().toString());
//            }
//        });
//    }
//}
